﻿@model ProductOverviewModel
@using Nop.Web.Models.Catalog;
@{
    //prepare "Add to cart" AJAX link
    string addtocartlink = "";
    if (Model.ProductPrice.ForceRedirectionAfterAddingToCart)
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });
    }
    else
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id });
    }    
}
<div class="product-item">
    <h2 class="product-title">
        <a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })">@Model.Name</a>
    </h2>
    <div class="picture">
        <a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">
            <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
        </a>
    </div>
    <div class="description">
        @Html.Raw(Model.ShortDescription)
    </div>
    <div class="add-info">
        <div class="prices">
            @if (!String.IsNullOrEmpty(Model.ProductPrice.OldPrice))
            {
                <span class="oldproductPrice">@Model.ProductPrice.OldPrice</span>
                <br />
            }
            <span class="productPrice">@Model.ProductPrice.Price</span>
        </div>
        <div class="buttons">
            <input type="button" value="@T("Products.Details")" class="productlistproductdetailbutton" onclick="setLocation('@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })')" />
            @if (!Model.ProductPrice.DisableBuyButton)
            {
                <br />                
                <input type="button" value="@(Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" class="productlistaddtocartbutton" onclick="AjaxCart.addproducttocart('@addtocartlink');return false;" />
            }
        </div>
        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "productbox_add_info" })
    </div>
</div>
